package proxy;

/**
 * 保姆类
 * @version v1.0
 * @Author JieGe
 * @Create 2024-11-30 - 11:52
 */
public class BaoMu implements Eat {

    // 内部含有对真实主题的引用
    private Eat obj;

    public void setObj(Eat obj) {
        this.obj = obj;
    }

    @Override
    public String eat() {  // 由保姆做事，具体小伍去吃
        before();
        String info = obj.eat(); // obj.eat()小伍回来吃饭
        after();
        return info;
    }

    public void before() {
        System.out.println("洗好菜");
        System.out.println("做好饭");
        System.out.println("打开平板");
        System.out.println("切换到抖音");
    }
    public void after() {
        System.out.println("擦嘴巴");
        System.out.println("洗碗");
        System.out.println("拖地板");
    }



}
